
EasyuiUtils={
    openWindows:function (id,title,width,height,url) {
      var content = '<iframe id="iframe'+id+'" src="' + url + '" width=100%" height="98%" frameborder="0" ></iframe>';
      var boarddiv = '<div id="'+id+'" title="' + title + '"></div>'//style="overflow:hidden;"可以去掉滚动条

      $(document.body).append(boarddiv);
      $('#'+id).show();
      var win = $('#'+id).dialog({
          content: content,
          width: width,
          height: height,
          modal: false,
          title: title,
          onClose : function() {
              $(this).dialog('destroy');
              $(this).remove();
          }
      });


    },
    alert:function (msg,fn,icon) {
        if(!icon){
            icon='info';
        }
        $.messager.alert({ title:'提示',msg:msg,icon:icon, top:$(window).height()/6,fn:fn});
    },
    confirm:function (msg,callBack,isNotTop) {
        var topDis=$(window).height()/6;
        if(isNotTop){
            topDis=null;
        }
        $.messager.confirm({ title:'提示',msg:msg, icon:'info',top: topDis,
            fn:function (r) {
                if(r){
                    callBack();
                }
            }
        });
    },
    confirmSubmit:function (msg,url,data,callBack,isNotTop) {
        var topDis=$(window).height()/6;
        if(isNotTop){
            topDis=null;
        }
        $.messager.confirm({ title:'提示',msg:msg, icon:'info',top: topDis,
            fn:function (r) {
                if(r){
                    $.post(url,data,function (data) {
                        EasyuiUtils.alert("操作成功！",function () {
                            if(callBack==null){
                                reload();
                            }else{
                                callBack();
                            }
                        });
                    });
                }
            }
        });
    },
    confirmDelete:function (tableId,url,callBack) {
        var row=this.getSelected(tableId);
        if(row){
            this.confirm("确定删除?",function () {
                $.post(url+"?id="+row.id,{},function (data) {
                    EasyuiUtils.alert("保存成功！",function () {
                        reload();
                    });
                    /*$.messager.show({
                        title:'提示',
                        msg:'删除成功!',
                        timeout:1500,
                        showType:'slide'
                    });*/
                });
            });
        }
    },
    confirmSave:function (url,data,callBack) {
        this.confirm("确认保存？",function () {
            jQuery.ajaxSettings.traditional = true;
            $.post(url,data,function (data) {
                EasyuiUtils.alert("保存成功！",function () {
                    callBack();
                });
            });
        },true);
    },
    getSelected:function (tableId) {
        var row = $(tableId).datagrid('getSelected');
        if(!row){
            EasyuiUtils.alert("请选择一条数据！");
        }
        return row;
    },
    getSelections:function (tableId) {
        var row = $(tableId).datagrid('getSelections');
        if(row==''){
            EasyuiUtils.alert("请选择一条数据！");
        }
        return row;
    }
};